import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('../views/About.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/quickLogin',
    name: 'quickLogin',
    component: () => import('../views/QuickLogin.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/Home.vue'),
    children: [
      // 0 default welcome page
      {
        path: '/welcome',
        name: 'welcome',
        component: () => import('../views/Welcome.vue')
      },
      // 0.1 密码修改
      {
        path: '/passwordModify',
        name: 'passwordModify',
        component: () => import('../views/PasswordModify.vue')
      },
      // 0.2 账号管理
      {
        path: '/accountManage',
        name: 'accountManage',
        component: () => import('../views/AccountMgmt.vue')
      },

      // 1 系统管理
      // 1.1 用户管理
      {
        path: '/userManage',
        name: 'userManage',
        component: () => import('../views/UserMgmt.vue')
      },
      // 1.2 角色管理
      {
        path: '/roleManage',
        name: 'roleManage',
        component: () => import('../views/RoleMgmt.vue')
      },
      // 1.3 权限管理
      {
        path: '/permissionManage',
        name: 'permissionManage',
        component: () => import('../views/PermissionMgmt.vue')
      },
      // 1.4 菜单管理
      {
        path: '/menuManage',
        name: 'menuManage',
        component: () => import('../views/MenuMgmt.vue')
      },

      // 2 未知管理

      // 3 区域管理
      // 3.1 区域管理
      {
        path: '/areaChangeLinked',
        name: 'areaChangeLinked',
        component: () => import('../views/AreaChangeLinked.vue')
      },
      // 3.2 区域查询
      {
        path: '/areaQuery',
        name: 'areaQuery',
        component: () => import('../views/AreaQuery.vue')
      },

      // 4 文件管理
      // 4.1 文件下载demo
      {
        path: '/fileDownloadDemo',
        name: 'fileDownloadDemo',
        component: () => import('../views/FileDownloadDemo.vue')
      },
      // 4.2 多文件上传demo1
      {
        path: '/multiFilesUploadDemo1',
        name: 'multiFilesUploadDemo1',
        component: () => import('../views/MultiFilesUploadDemo1.vue')
      },
      // 4.3 多文件上传demo2
      {
        path: '/multiFilesUploadDemo2',
        name: 'multiFilesUploadDemo2',
        component: () => import('../views/MultiFilesUploadDemo2.vue')
      },

      // 5 短网址服务
      // 5.1 短网址生成
      {
        path: '/dwzGenerate',
        name: 'dwzGenerate',
        component: () => import('../views/DwzGenerate.vue')
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
